package com.flong.lambda;

import org.junit.Test;

import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;

/**
 * @Author:liangjl
 * @Date: 2020/6/20-19:03
 * @Eamil:jilongliang@sina.com
 * @Description:
 */
public class Test5 {

    @Test
    public void test1() {

        printMax((maxs)->{
            getaVoidx(maxs);
        });

        //方法引用
        printMax(Test5::getaVoidx);

    }

    private static void getaVoidx(int[] ints) {
        int sum = 0;
        for (int n : ints) {
            sum += n;
        }
        System.out.println(sum);
    }


    public static void printMax(Consumer<int[]> consumers) {
        int[] arr = {10, 20, 30, 90};
        consumers.accept(arr);
    }

}
